<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Module      :  Distribution.Simple.Program</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Copyright   :  Isaac Jones 2006, Duncan Coutts 2007-2009</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Maintainer  :  cabal-devel@haskell.org</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- This provides an abstraction which deals with configuring and running</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- programs. A 'Program' is a static notion of a known program. A</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- 'ConfiguredProgram' is a 'Program' that has been found on the current</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- machine and is ready to be run (possibly with some user-supplied default</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- args). Configuring a program involves finding its location and if necessary</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- finding its version. There is also a 'ProgramDb' type which holds</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- configured and not-yet configured programs. It is the parameter to lots of</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- actions elsewhere in Cabal that need to look up and run programs. If we had</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- a Cabal monad, the 'ProgramDb' would probably be a reader or</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- state component of it.</span><span>
</span><span id="line-22"></span><span class="hs-comment">--</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- The module also defines all the known built-in 'Program's and the</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- 'defaultProgramDb' which contains them all.</span><span>
</span><span id="line-25"></span><span class="hs-comment">--</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- One nice thing about using it is that any program that is</span><span>
</span><span id="line-27"></span><span class="hs-comment">-- registered with Cabal will get some \&quot;configure\&quot; and \&quot;.cabal\&quot;</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- helpers like --with-foo-args --foo-path= and extra-foo-args.</span><span>
</span><span id="line-29"></span><span class="hs-comment">--</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- There's also good default behavior for trying to find \&quot;foo\&quot; in</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- PATH, being able to override its location, etc.</span><span>
</span><span id="line-32"></span><span class="hs-comment">--</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- There's also a hook for adding programs in a Setup.lhs script.  See</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- hookedPrograms in 'Distribution.Simple.UserHooks'.  This gives a</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- hook user the ability to get the above flags and such so that they</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- don't have to write all the PATH logic inside Setup.lhs.</span><span>
</span><span id="line-37"></span><span>
</span><span id="line-38"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Distribution.Simple.Program</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Program and functions for constructing them</span></span><span>
</span><span id="line-40"></span><span>      </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#Program"><span class="hs-identifier">Program</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Find.html#ProgramSearchPath"><span class="hs-identifier">ProgramSearchPath</span></a></span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Find.html#ProgramSearchPathEntry"><span class="hs-identifier">ProgramSearchPathEntry</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#simpleProgram"><span class="hs-identifier">simpleProgram</span></a></span><span>
</span><span id="line-44"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Find.html#findProgramOnSearchPath"><span class="hs-identifier">findProgramOnSearchPath</span></a></span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Find.html#defaultProgramSearchPath"><span class="hs-identifier">defaultProgramSearchPath</span></a></span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Utils.html#findProgramVersion"><span class="hs-identifier">findProgramVersion</span></a></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Configured program and related functions</span></span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ConfiguredProgram"><span class="hs-identifier">ConfiguredProgram</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#programPath"><span class="hs-identifier">programPath</span></a></span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ProgArg"><span class="hs-identifier">ProgArg</span></a></span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ProgramLocation"><span class="hs-identifier">ProgramLocation</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.html#runProgram"><span class="hs-identifier">runProgram</span></a></span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.html#getProgramOutput"><span class="hs-identifier">getProgramOutput</span></a></span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#suppressOverrideArgs"><span class="hs-identifier">suppressOverrideArgs</span></a></span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Program invocations</span></span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#ProgramInvocation"><span class="hs-identifier">ProgramInvocation</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#emptyProgramInvocation"><span class="hs-identifier">emptyProgramInvocation</span></a></span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#simpleProgramInvocation"><span class="hs-identifier">simpleProgramInvocation</span></a></span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier">programInvocation</span></a></span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#runProgramInvocation"><span class="hs-identifier">runProgramInvocation</span></a></span><span>
</span><span id="line-63"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#getProgramInvocationOutput"><span class="hs-identifier">getProgramInvocationOutput</span></a></span><span>
</span><span id="line-64"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html#getProgramInvocationLBS"><span class="hs-identifier">getProgramInvocationLBS</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The collection of unconfigured and configured programs</span></span><span>
</span><span id="line-67"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#builtinPrograms"><span class="hs-identifier">builtinPrograms</span></a></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The collection of configured programs we can run</span></span><span>
</span><span id="line-70"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#ProgramDb"><span class="hs-identifier">ProgramDb</span></a></span><span>
</span><span id="line-71"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#defaultProgramDb"><span class="hs-identifier">defaultProgramDb</span></a></span><span>
</span><span id="line-72"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#emptyProgramDb"><span class="hs-identifier">emptyProgramDb</span></a></span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#restoreProgramDb"><span class="hs-identifier">restoreProgramDb</span></a></span><span>
</span><span id="line-74"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#addKnownProgram"><span class="hs-identifier">addKnownProgram</span></a></span><span>
</span><span id="line-75"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#addKnownPrograms"><span class="hs-identifier">addKnownPrograms</span></a></span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#lookupKnownProgram"><span class="hs-identifier">lookupKnownProgram</span></a></span><span>
</span><span id="line-77"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#knownPrograms"><span class="hs-identifier">knownPrograms</span></a></span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#getProgramSearchPath"><span class="hs-identifier">getProgramSearchPath</span></a></span><span>
</span><span id="line-79"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#setProgramSearchPath"><span class="hs-identifier">setProgramSearchPath</span></a></span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#userSpecifyPath"><span class="hs-identifier">userSpecifyPath</span></a></span><span>
</span><span id="line-81"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#userSpecifyPaths"><span class="hs-identifier">userSpecifyPaths</span></a></span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#userMaybeSpecifyPath"><span class="hs-identifier">userMaybeSpecifyPath</span></a></span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#userSpecifyArgs"><span class="hs-identifier">userSpecifyArgs</span></a></span><span>
</span><span id="line-84"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#userSpecifyArgss"><span class="hs-identifier">userSpecifyArgss</span></a></span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#userSpecifiedArgs"><span class="hs-identifier">userSpecifiedArgs</span></a></span><span>
</span><span id="line-86"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#lookupProgram"><span class="hs-identifier">lookupProgram</span></a></span><span>
</span><span id="line-87"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#lookupProgramVersion"><span class="hs-identifier">lookupProgramVersion</span></a></span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#updateProgram"><span class="hs-identifier">updateProgram</span></a></span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#configureProgram"><span class="hs-identifier">configureProgram</span></a></span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#configureAllKnownPrograms"><span class="hs-identifier">configureAllKnownPrograms</span></a></span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#reconfigurePrograms"><span class="hs-identifier">reconfigurePrograms</span></a></span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#requireProgram"><span class="hs-identifier">requireProgram</span></a></span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#requireProgramVersion"><span class="hs-identifier">requireProgramVersion</span></a></span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#needProgram"><span class="hs-identifier">needProgram</span></a></span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.html#runDbProgram"><span class="hs-identifier">runDbProgram</span></a></span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.html#getDbProgramOutput"><span class="hs-identifier">getDbProgramOutput</span></a></span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Programs that Cabal knows about</span></span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#ghcProgram"><span class="hs-identifier">ghcProgram</span></a></span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#ghcPkgProgram"><span class="hs-identifier">ghcPkgProgram</span></a></span><span>
</span><span id="line-101"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#ghcjsProgram"><span class="hs-identifier">ghcjsProgram</span></a></span><span>
</span><span id="line-102"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#ghcjsPkgProgram"><span class="hs-identifier">ghcjsPkgProgram</span></a></span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#hmakeProgram"><span class="hs-identifier">hmakeProgram</span></a></span><span>
</span><span id="line-104"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#jhcProgram"><span class="hs-identifier">jhcProgram</span></a></span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#uhcProgram"><span class="hs-identifier">uhcProgram</span></a></span><span>
</span><span id="line-106"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#gccProgram"><span class="hs-identifier">gccProgram</span></a></span><span>
</span><span id="line-107"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#arProgram"><span class="hs-identifier">arProgram</span></a></span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#stripProgram"><span class="hs-identifier">stripProgram</span></a></span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#happyProgram"><span class="hs-identifier">happyProgram</span></a></span><span>
</span><span id="line-110"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#alexProgram"><span class="hs-identifier">alexProgram</span></a></span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#hsc2hsProgram"><span class="hs-identifier">hsc2hsProgram</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#c2hsProgram"><span class="hs-identifier">c2hsProgram</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#cpphsProgram"><span class="hs-identifier">cpphsProgram</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#hscolourProgram"><span class="hs-identifier">hscolourProgram</span></a></span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#doctestProgram"><span class="hs-identifier">doctestProgram</span></a></span><span>
</span><span id="line-116"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#haddockProgram"><span class="hs-identifier">haddockProgram</span></a></span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#greencardProgram"><span class="hs-identifier">greencardProgram</span></a></span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#ldProgram"><span class="hs-identifier">ldProgram</span></a></span><span>
</span><span id="line-119"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#tarProgram"><span class="hs-identifier">tarProgram</span></a></span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#cppProgram"><span class="hs-identifier">cppProgram</span></a></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#pkgConfigProgram"><span class="hs-identifier">pkgConfigProgram</span></a></span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html#hpcProgram"><span class="hs-identifier">hpcProgram</span></a></span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-126"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Compat.Prelude.html"><span class="hs-identifier">Distribution.Compat.Prelude</span></a></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html"><span class="hs-identifier">Distribution.Simple.Program.Types</span></a></span><span>
</span><span id="line-129"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Run.html"><span class="hs-identifier">Distribution.Simple.Program.Run</span></a></span><span>
</span><span id="line-130"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html"><span class="hs-identifier">Distribution.Simple.Program.Db</span></a></span><span>
</span><span id="line-131"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Builtin.html"><span class="hs-identifier">Distribution.Simple.Program.Builtin</span></a></span><span>
</span><span id="line-132"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Find.html"><span class="hs-identifier">Distribution.Simple.Program.Find</span></a></span><span>
</span><span id="line-133"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Simple.Utils.html"><span class="hs-identifier">Distribution.Simple.Utils</span></a></span><span>
</span><span id="line-134"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html"><span class="hs-identifier">Distribution.Verbosity</span></a></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span class="hs-comment">-- | Runs the given configured program.</span><span>
</span><span id="line-137"></span><span class="annot"><a href="Distribution.Simple.Program.html#runProgram"><span class="hs-identifier hs-type">runProgram</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html#Verbosity"><span class="hs-identifier hs-type">Verbosity</span></a></span><span>          </span><span class="hs-comment">-- ^Verbosity</span><span>
</span><span id="line-138"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ConfiguredProgram"><span class="hs-identifier hs-type">ConfiguredProgram</span></a></span><span>  </span><span class="hs-comment">-- ^The program to run</span><span>
</span><span id="line-139"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ProgArg"><span class="hs-identifier hs-type">ProgArg</span></a></span><span class="hs-special">]</span><span>          </span><span class="hs-comment">-- ^Any /extra/ arguments to add</span><span>
</span><span id="line-140"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span id="runProgram"><span class="annot"><span class="annottext">runProgram :: Verbosity -&gt; ConfiguredProgram -&gt; [ProgArg] -&gt; IO ()
</span><a href="Distribution.Simple.Program.html#runProgram"><span class="hs-identifier hs-var hs-var">runProgram</span></a></span></span><span> </span><span id="local-6989586621679688984"><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688984"><span class="hs-identifier hs-var">verbosity</span></a></span></span><span> </span><span id="local-6989586621679688983"><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688983"><span class="hs-identifier hs-var">prog</span></a></span></span><span> </span><span id="local-6989586621679688982"><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688982"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-142"></span><span>  </span><span class="annot"><span class="annottext">Verbosity -&gt; ProgramInvocation -&gt; IO ()
</span><a href="Distribution.Simple.Program.Run.html#runProgramInvocation"><span class="hs-identifier hs-var">runProgramInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688984"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConfiguredProgram -&gt; [ProgArg] -&gt; ProgramInvocation
</span><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier hs-var">programInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688983"><span class="hs-identifier hs-var">prog</span></a></span><span> </span><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688982"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-comment">-- | Runs the given configured program and gets the output.</span><span>
</span><span id="line-146"></span><span class="hs-comment">--</span><span>
</span><span id="line-147"></span><span class="annot"><a href="Distribution.Simple.Program.html#getProgramOutput"><span class="hs-identifier hs-type">getProgramOutput</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html#Verbosity"><span class="hs-identifier hs-type">Verbosity</span></a></span><span>          </span><span class="hs-comment">-- ^Verbosity</span><span>
</span><span id="line-148"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ConfiguredProgram"><span class="hs-identifier hs-type">ConfiguredProgram</span></a></span><span>  </span><span class="hs-comment">-- ^The program to run</span><span>
</span><span id="line-149"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ProgArg"><span class="hs-identifier hs-type">ProgArg</span></a></span><span class="hs-special">]</span><span>          </span><span class="hs-comment">-- ^Any /extra/ arguments to add</span><span>
</span><span id="line-150"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-151"></span><span id="getProgramOutput"><span class="annot"><span class="annottext">getProgramOutput :: Verbosity -&gt; ConfiguredProgram -&gt; [ProgArg] -&gt; IO ProgArg
</span><a href="Distribution.Simple.Program.html#getProgramOutput"><span class="hs-identifier hs-var hs-var">getProgramOutput</span></a></span></span><span> </span><span id="local-6989586621679688981"><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688981"><span class="hs-identifier hs-var">verbosity</span></a></span></span><span> </span><span id="local-6989586621679688980"><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688980"><span class="hs-identifier hs-var">prog</span></a></span></span><span> </span><span id="local-6989586621679688979"><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688979"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-152"></span><span>  </span><span class="annot"><span class="annottext">Verbosity -&gt; ProgramInvocation -&gt; IO ProgArg
</span><a href="Distribution.Simple.Program.Run.html#getProgramInvocationOutput"><span class="hs-identifier hs-var">getProgramInvocationOutput</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688981"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConfiguredProgram -&gt; [ProgArg] -&gt; ProgramInvocation
</span><a href="Distribution.Simple.Program.Run.html#programInvocation"><span class="hs-identifier hs-var">programInvocation</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688980"><span class="hs-identifier hs-var">prog</span></a></span><span> </span><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688979"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span>
</span><span id="line-155"></span><span class="hs-comment">-- | Looks up the given program in the program database and runs it.</span><span>
</span><span id="line-156"></span><span class="hs-comment">--</span><span>
</span><span id="line-157"></span><span class="annot"><a href="Distribution.Simple.Program.html#runDbProgram"><span class="hs-identifier hs-type">runDbProgram</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html#Verbosity"><span class="hs-identifier hs-type">Verbosity</span></a></span><span>  </span><span class="hs-comment">-- ^verbosity</span><span>
</span><span id="line-158"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#Program"><span class="hs-identifier hs-type">Program</span></a></span><span>    </span><span class="hs-comment">-- ^The program to run</span><span>
</span><span id="line-159"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#ProgramDb"><span class="hs-identifier hs-type">ProgramDb</span></a></span><span>  </span><span class="hs-comment">-- ^look up the program here</span><span>
</span><span id="line-160"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ProgArg"><span class="hs-identifier hs-type">ProgArg</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- ^Any /extra/ arguments to add</span><span>
</span><span id="line-161"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span id="runDbProgram"><span class="annot"><span class="annottext">runDbProgram :: Verbosity -&gt; Program -&gt; ProgramDb -&gt; [ProgArg] -&gt; IO ()
</span><a href="Distribution.Simple.Program.html#runDbProgram"><span class="hs-identifier hs-var hs-var">runDbProgram</span></a></span></span><span> </span><span id="local-6989586621679688978"><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688978"><span class="hs-identifier hs-var">verbosity</span></a></span></span><span> </span><span id="local-6989586621679688977"><span class="annot"><span class="annottext">Program
</span><a href="#local-6989586621679688977"><span class="hs-identifier hs-var">prog</span></a></span></span><span> </span><span id="local-6989586621679688976"><span class="annot"><span class="annottext">ProgramDb
</span><a href="#local-6989586621679688976"><span class="hs-identifier hs-var">programDb</span></a></span></span><span> </span><span id="local-6989586621679688975"><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688975"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-163"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Program -&gt; ProgramDb -&gt; Maybe ConfiguredProgram
</span><a href="Distribution.Simple.Program.Db.html#lookupProgram"><span class="hs-identifier hs-var">lookupProgram</span></a></span><span> </span><span class="annot"><span class="annottext">Program
</span><a href="#local-6989586621679688977"><span class="hs-identifier hs-var">prog</span></a></span><span> </span><span class="annot"><span class="annottext">ProgramDb
</span><a href="#local-6989586621679688976"><span class="hs-identifier hs-var">programDb</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-164"></span><span>    </span><span class="annot"><span class="annottext">Maybe ConfiguredProgram
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Verbosity -&gt; ProgArg -&gt; IO ()
forall a. Verbosity -&gt; ProgArg -&gt; IO a
</span><a href="Distribution.Simple.Utils.html#die%27"><span class="hs-identifier hs-var">die'</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688978"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">ProgArg
</span><a href="#local-6989586621679688973"><span class="hs-identifier hs-var">notFound</span></a></span><span>
</span><span id="line-165"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679688972"><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688972"><span class="hs-identifier hs-var">configuredProg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Verbosity -&gt; ConfiguredProgram -&gt; [ProgArg] -&gt; IO ()
</span><a href="Distribution.Simple.Program.html#runProgram"><span class="hs-identifier hs-var">runProgram</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688978"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688972"><span class="hs-identifier hs-var">configuredProg</span></a></span><span> </span><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688975"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-166"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-167"></span><span>   </span><span id="local-6989586621679688973"><span class="annot"><span class="annottext">notFound :: ProgArg
</span><a href="#local-6989586621679688973"><span class="hs-identifier hs-var hs-var">notFound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ProgArg
</span><span class="hs-string">&quot;The program '&quot;</span></span><span> </span><span class="annot"><span class="annottext">ProgArg -&gt; ProgArg -&gt; ProgArg
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Program -&gt; ProgArg
</span><a href="Distribution.Simple.Program.Types.html#programName"><span class="hs-identifier hs-var hs-var">programName</span></a></span><span> </span><span class="annot"><span class="annottext">Program
</span><a href="#local-6989586621679688977"><span class="hs-identifier hs-var">prog</span></a></span><span>
</span><span id="line-168"></span><span>           </span><span class="annot"><span class="annottext">ProgArg -&gt; ProgArg -&gt; ProgArg
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">ProgArg
</span><span class="hs-string">&quot;' is required but it could not be found&quot;</span></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-comment">-- | Looks up the given program in the program database and runs it.</span><span>
</span><span id="line-171"></span><span class="hs-comment">--</span><span>
</span><span id="line-172"></span><span class="annot"><a href="Distribution.Simple.Program.html#getDbProgramOutput"><span class="hs-identifier hs-type">getDbProgramOutput</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Distribution.Verbosity.html#Verbosity"><span class="hs-identifier hs-type">Verbosity</span></a></span><span>  </span><span class="hs-comment">-- ^verbosity</span><span>
</span><span id="line-173"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Types.html#Program"><span class="hs-identifier hs-type">Program</span></a></span><span>    </span><span class="hs-comment">-- ^The program to run</span><span>
</span><span id="line-174"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Distribution.Simple.Program.Db.html#ProgramDb"><span class="hs-identifier hs-type">ProgramDb</span></a></span><span>  </span><span class="hs-comment">-- ^look up the program here</span><span>
</span><span id="line-175"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Distribution.Simple.Program.Types.html#ProgArg"><span class="hs-identifier hs-type">ProgArg</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- ^Any /extra/ arguments to add</span><span>
</span><span id="line-176"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-177"></span><span id="getDbProgramOutput"><span class="annot"><span class="annottext">getDbProgramOutput :: Verbosity -&gt; Program -&gt; ProgramDb -&gt; [ProgArg] -&gt; IO ProgArg
</span><a href="Distribution.Simple.Program.html#getDbProgramOutput"><span class="hs-identifier hs-var hs-var">getDbProgramOutput</span></a></span></span><span> </span><span id="local-6989586621679688970"><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688970"><span class="hs-identifier hs-var">verbosity</span></a></span></span><span> </span><span id="local-6989586621679688969"><span class="annot"><span class="annottext">Program
</span><a href="#local-6989586621679688969"><span class="hs-identifier hs-var">prog</span></a></span></span><span> </span><span id="local-6989586621679688968"><span class="annot"><span class="annottext">ProgramDb
</span><a href="#local-6989586621679688968"><span class="hs-identifier hs-var">programDb</span></a></span></span><span> </span><span id="local-6989586621679688967"><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688967"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-178"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Program -&gt; ProgramDb -&gt; Maybe ConfiguredProgram
</span><a href="Distribution.Simple.Program.Db.html#lookupProgram"><span class="hs-identifier hs-var">lookupProgram</span></a></span><span> </span><span class="annot"><span class="annottext">Program
</span><a href="#local-6989586621679688969"><span class="hs-identifier hs-var">prog</span></a></span><span> </span><span class="annot"><span class="annottext">ProgramDb
</span><a href="#local-6989586621679688968"><span class="hs-identifier hs-var">programDb</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-179"></span><span>    </span><span class="annot"><span class="annottext">Maybe ConfiguredProgram
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Verbosity -&gt; ProgArg -&gt; IO ProgArg
forall a. Verbosity -&gt; ProgArg -&gt; IO a
</span><a href="Distribution.Simple.Utils.html#die%27"><span class="hs-identifier hs-var">die'</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688970"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">ProgArg
</span><a href="#local-6989586621679688966"><span class="hs-identifier hs-var">notFound</span></a></span><span>
</span><span id="line-180"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679688965"><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688965"><span class="hs-identifier hs-var">configuredProg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Verbosity -&gt; ConfiguredProgram -&gt; [ProgArg] -&gt; IO ProgArg
</span><a href="Distribution.Simple.Program.html#getProgramOutput"><span class="hs-identifier hs-var">getProgramOutput</span></a></span><span> </span><span class="annot"><span class="annottext">Verbosity
</span><a href="#local-6989586621679688970"><span class="hs-identifier hs-var">verbosity</span></a></span><span> </span><span class="annot"><span class="annottext">ConfiguredProgram
</span><a href="#local-6989586621679688965"><span class="hs-identifier hs-var">configuredProg</span></a></span><span> </span><span class="annot"><span class="annottext">[ProgArg]
</span><a href="#local-6989586621679688967"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-181"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-182"></span><span>   </span><span id="local-6989586621679688966"><span class="annot"><span class="annottext">notFound :: ProgArg
</span><a href="#local-6989586621679688966"><span class="hs-identifier hs-var hs-var">notFound</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ProgArg
</span><span class="hs-string">&quot;The program '&quot;</span></span><span> </span><span class="annot"><span class="annottext">ProgArg -&gt; ProgArg -&gt; ProgArg
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Program -&gt; ProgArg
</span><a href="Distribution.Simple.Program.Types.html#programName"><span class="hs-identifier hs-var hs-var">programName</span></a></span><span> </span><span class="annot"><span class="annottext">Program
</span><a href="#local-6989586621679688969"><span class="hs-identifier hs-var">prog</span></a></span><span>
</span><span id="line-183"></span><span>           </span><span class="annot"><span class="annottext">ProgArg -&gt; ProgArg -&gt; ProgArg
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">ProgArg
</span><span class="hs-string">&quot;' is required but it could not be found&quot;</span></span><span>
</span><span id="line-184"></span></pre></body></html>